home *** CD-ROM | disk | FTP | other *** search
/ Internet.Works 39 / Issue 39.iso / pc / PCSoftware / AceHTML 4.0 / AceHTML4Pro.exe / %MAINDIR% / ScriptDef / Upper Right Corner flying text.sd < prev    next >
Encoding:
INI File  |  2000-08-31  |  8.3 KB  |  284 lines

  1. [SUBJECT]
  2. Description=Upper Right Corner flying text Script
  3. ImageIndex=-1
  4. Folder=DHTML Text Effects
  5.  
  6.  
  7. [HEAD_TEXT]
  8. ;<script LANGUAGE="JavaScript" FPTYPE="mydynamicanimation">
  9. ;<!--
  10. ;  dynamicanimAttr = "mydynamicanimation"
  11. ;  animateElements = new Array()
  12. ;  currentElement = 0
  13. ;  speed = 0
  14. ;  stepsZoom = 8
  15. ;  stepsWord = 8
  16. ;  stepsFly = 12
  17. ;  stepsSpiral = 16
  18. ;  steps = stepsZoom
  19. ;  step = 0
  20. ;  outString = ""
  21. ;  function mydynAnimation()
  22. ;  {
  23. ;    var ms = navigator.appVersion.indexOf("MSIE")
  24. ;    ie4 = (ms>0) && (parseInt(navigator.appVersion.substring(ms+5, ms+6)) >= 4)
  25. ;    if(!ie4)
  26. ;    {
  27. ;      if((navigator.appName == "Netscape") &&
  28. ;         (parseInt(navigator.appVersion.substring(0, 1)) >= 4))
  29. ;      {
  30. ;        for (index=document.layers.length-1; index >= 0; index--)
  31. ;        {
  32. ;            layer=document.layers[index]
  33. ;            if (layer.left==10000)
  34. ;                layer.left=0
  35. ;        }
  36. ;      }
  37. ;      return
  38. ;    }
  39. ;    for (index=document.all.length-1; index >= document.body.sourceIndex; index--)
  40. ;    {
  41. ;      el = document.all[index]
  42. ;      animation = el.getAttribute(dynamicanimAttr, false)
  43. ;      if(null != animation)
  44. ;      {
  45. ;        if(animation == "dropWord" || animation == "flyTopRightWord" || animation == "flyBottomRightWord")
  46. ;        {
  47. ;          ih = el.innerHTML
  48. ;          outString = ""
  49. ;          i1 = 0
  50. ;          iend = ih.length
  51. ;          while(true)
  52. ;          {
  53. ;            i2 = startWord(ih, i1)
  54. ;            if(i2 == -1)
  55. ;              i2 = iend
  56. ;            outWord(ih, i1, i2, false, "")
  57. ;            if(i2 == iend)
  58. ;              break
  59. ;            i1 = i2
  60. ;            i2 = endWord(ih, i1)
  61. ;            if(i2 == -1)
  62. ;              i2 = iend
  63. ;            outWord(ih, i1, i2, true, animation)
  64. ;            if(i2 == iend)
  65. ;              break
  66. ;            i1 = i2
  67. ;          }
  68. ;          document.all[index].innerHTML = outString
  69. ;          document.all[index].style.posLeft = 0
  70. ;          document.all[index].setAttribute(dynamicanimAttr, null)
  71. ;        }
  72. ;        if(animation == "zoomIn" || animation == "zoomOut")
  73. ;        {
  74. ;          ih = el.innerHTML
  75. ;          outString = "<SPAN " + dynamicanimAttr + "=\"" + animation + "\" style=\"position: relative; left: 10000;\">"
  76. ;          outString += ih
  77. ;          outString += "</SPAN>"
  78. ;          document.all[index].innerHTML = outString
  79. ;          document.all[index].style.posLeft = 0
  80. ;          document.all[index].setAttribute(dynamicanimAttr, null)
  81. ;        }
  82. ;      }
  83. ;    }
  84. ;    i = 0
  85. ;    for (index=document.body.sourceIndex; index < document.all.length; index++)
  86. ;    {
  87. ;      el = document.all[index]
  88. ;      animation = el.getAttribute(dynamicanimAttr, false)
  89. ;      if (null != animation)
  90. ;      {
  91. ;        if(animation == "flyLeft")
  92. ;        {
  93. ;          el.style.posLeft = 10000-offsetLeft(el)-el.offsetWidth
  94. ;          el.style.posTop = 0
  95. ;        }
  96. ;        else if(animation == "flyRight")
  97. ;        {
  98. ;          el.style.posLeft = 10000-offsetLeft(el)+document.body.offsetWidth
  99. ;          el.style.posTop = 0
  100. ;        }
  101. ;        else if(animation == "flyTop" || animation == "dropWord")
  102. ;        {
  103. ;          el.style.posLeft = 0
  104. ;          el.style.posTop = document.body.scrollTop-offsetTop(el)-el.offsetHeight
  105. ;        }
  106. ;        else if(animation == "flyBottom")
  107. ;        {
  108. ;          el.style.posLeft = 0
  109. ;          el.style.posTop = document.body.scrollTop-offsetTop(el)+document.body.offsetHeight
  110. ;        }
  111. ;        else if(animation == "flyTopLeft")
  112. ;        {
  113. ;          el.style.posLeft = 10000-offsetLeft(el)-el.offsetWidth
  114. ;          el.style.posTop = document.body.scrollTop-offsetTop(el)-el.offsetHeight
  115. ;        }
  116. ;        else if(animation == "flyTopRight" || animation == "flyTopRightWord")
  117. ;        {
  118. ;          el.style.posLeft = 10000-offsetLeft(el)+document.body.offsetWidth
  119. ;          el.style.posTop = document.body.scrollTop-offsetTop(el)-el.offsetHeight
  120. ;        }
  121. ;        else if(animation == "flyBottomLeft")
  122. ;        {
  123. ;          el.style.posLeft = 10000-offsetLeft(el)-el.offsetWidth
  124. ;          el.style.posTop = document.body.scrollTop-offsetTop(el)+document.body.offsetHeight
  125. ;        }
  126. ;        else if(animation == "flyBottomRight" || animation == "flyBottomRightWord")
  127. ;        {
  128. ;          el.style.posLeft = 10000-offsetLeft(el)+document.body.offsetWidth
  129. ;          el.style.posTop = document.body.scrollTop-offsetTop(el)+document.body.offsetHeight
  130. ;        }
  131. ;        else if(animation == "spiral")
  132. ;        {
  133. ;          el.style.posLeft = 10000-offsetLeft(el)-el.offsetWidth
  134. ;          el.style.posTop = document.body.scrollTop-offsetTop(el)-el.offsetHeight
  135. ;        }
  136. ;        else if(animation == "zoomIn")
  137. ;        {
  138. ;          el.style.posLeft = 10000
  139. ;          el.style.posTop = 0
  140. ;        }
  141. ;        else if(animation == "zoomOut")
  142. ;        {
  143. ;          el.style.posLeft = 10000
  144. ;          el.style.posTop = 0
  145. ;        }
  146. ;        else
  147. ;        {
  148. ;          el.style.posLeft = 10000-offsetLeft(el)-el.offsetWidth
  149. ;          el.style.posTop = 0
  150. ;        }
  151. ;        el.initLeft = el.style.posLeft
  152. ;        el.initTop = el.style.posTop
  153. ;        animateElements[i++] = el
  154. ;      }
  155. ;    }
  156. ;    window.setTimeout("animate();", speed)
  157. ;  }
  158. ;  function offsetLeft(el)
  159. ;  {
  160. ;    x = el.offsetLeft
  161. ;    for (e = el.offsetParent; e; e = e.offsetParent)
  162. ;      x += e.offsetLeft;
  163. ;    return x
  164. ;  } 
  165. ;  function offsetTop(el)
  166. ;  {
  167. ;    y = el.offsetTop
  168. ;    for (e = el.offsetParent; e; e = e.offsetParent)
  169. ;      y += e.offsetTop;
  170. ;    return y
  171. ;  } 
  172. ;  function startWord(ih, i)
  173. ;  {
  174. ;    for(tag = false; i < ih.length; i++)
  175. ;    {
  176. ;      c = ih.charAt(i)
  177. ;      if(c == '<')
  178. ;        tag = true
  179. ;      if(!tag)
  180. ;        return i
  181. ;      if(c == '>')
  182. ;        tag = false
  183. ;    }
  184. ;    return -1
  185. ;  }
  186. ;  function endWord(ih, i)
  187. ;  {
  188. ;    nonSpace = false
  189. ;    space = false
  190. ;    while(i < ih.length)
  191. ;    {
  192. ;      c = ih.charAt(i)
  193. ;      if(c != ' ')
  194. ;        nonSpace = true
  195. ;      if(nonSpace && c == ' ')
  196. ;        space = true
  197. ;      if(c == '<')
  198. ;        return i
  199. ;      if(space && c != ' ')
  200. ;        return i
  201. ;      i++
  202. ;    }
  203. ;    return -1
  204. ;  }
  205. ;  function outWord(ih, i1, i2, dyn, anim)
  206. ;  {
  207. ;    if(dyn)
  208. ;      outString += "<SPAN " + dynamicanimAttr + "=\"" + anim + "\" style=\"position: relative; left: 10000;\">"
  209. ;    outString += ih.substring(i1, i2)
  210. ;    if(dyn)
  211. ;      outString += "</SPAN>"
  212. ;  }
  213. ;  function animate()
  214. ;  {
  215. ;    el = animateElements[currentElement]
  216. ;    animation = el.getAttribute(dynamicanimAttr, false)
  217. ;    step++
  218. ;    if(animation == "spiral")
  219. ;    {
  220. ;      steps = stepsSpiral
  221. ;      v = step/steps
  222. ;      rf = 1.0 - v
  223. ;      t = v * 2.0*Math.PI
  224. ;      rx = Math.max(Math.abs(el.initLeft), 200)
  225. ;      ry = Math.max(Math.abs(el.initTop),  200)
  226. ;      el.style.posLeft = Math.ceil(-rf*Math.cos(t)*rx)
  227. ;      el.style.posTop  = Math.ceil(-rf*Math.sin(t)*ry)
  228. ;    }
  229. ;    else if(animation == "zoomIn")
  230. ;    {
  231. ;      steps = stepsZoom
  232. ;      el.style.fontSize = Math.ceil(50+50*step/steps) + "%"
  233. ;      el.style.posLeft = 0
  234. ;    }
  235. ;    else if(animation == "zoomOut")
  236. ;    {
  237. ;      steps = stepsZoom
  238. ;      el.style.fontSize = Math.ceil(100+200*(steps-step)/steps) + "%"
  239. ;      el.style.posLeft = 0
  240. ;    }
  241. ;    else
  242. ;    {
  243. ;      steps = stepsFly
  244. ;      if(animation == "dropWord" || animation == "flyTopRightWord" || animation == "flyBottomRightWord")
  245. ;        steps = stepsWord
  246. ;      dl = el.initLeft / steps
  247. ;      dt = el.initTop  / steps
  248. ;      el.style.posLeft = el.style.posLeft - dl
  249. ;      el.style.posTop = el.style.posTop - dt
  250. ;    }
  251. ;    if (step >= steps) 
  252. ;    {
  253. ;      el.style.posLeft = 0
  254. ;      el.style.posTop = 0
  255. ;      currentElement++
  256. ;      step = 0
  257. ;    }
  258. ;    if(currentElement < animateElements.length)
  259. ;      window.setTimeout("animate();", speed)
  260. ;  }
  261. ;//-->
  262. ;</script>
  263.  
  264.  
  265. [BODY_TAG]
  266. ;onload="mydynAnimation()"
  267.  
  268.  
  269. [BODY_TEXT]
  270. ;<p align="center" mydynamicanimation="flyTopRightWord"
  271. ;style="position: relative !important; left: 10000 !important"><strong><big><big><font
  272. ;face="Arial">`title`</font></big></big></strong></p>
  273.  
  274.  
  275.  
  276.  
  277.  
  278. [`title`]
  279. Kind=S
  280. Value=Welcome to <a href="http://www.dynamicdrive.com">Dynamic Drive</a>, your ultimate DHTML source.
  281.  
  282.  
  283.  
  284.